package me.landery.modules.sinco.repository;

import me.landery.modules.sinco.domain.Application;
import me.landery.modules.sinco.domain.Call;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ApplicationRepository  extends JpaRepository<Application, Long>, JpaSpecificationExecutor<Application> {

    @Query(value = "select * from `sinco_app` where `uid` = ?1", nativeQuery = true)
    List<Application> findByUserId(Long currentUserId);

    Application findByUserIdAndName(Long currentUserId, String name);

    Application findByUserIdAndAppid(Long currentUserId, String appid);

    Application findByAppid(String appid);
}
